import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'
import HomeView from '../views/HomeView.vue'

const routes: Array<RouteRecordRaw> = [

  {
    path: '/',
    redirect: '/home'
  },

  {
    path: '/login',
    name: 'login',
    component: () => import('@/views/login.vue')
  },
  {
    path: '/',
    name: 'index',
    meta: { title: "首页" },
    component: () => import('@/views/index.vue'),
    children: [
      {
        path: '/home',
        name: 'home',
        meta: { title: '仪表盘' },
        component: HomeView
      },
      {
        path: '/addcustodian',
        name: 'addcustodian',
        meta: { title: '添加管理员' },
        component: () => import('@/views/addcustodian.vue')
      },
      {
        path: '/addition',
        name: 'addition',
        meta: { title: '添加产品' },
        component: () => import('@/views/addition.vue')
      },
      {
        path: '/centralPoint',
        name: 'centralPoint',
        meta: { title: '焦点图管理' },
        component: () => import('@/views/centralPoint.vue')
      },
      {
        path: '/classmanagement',
        name: 'classmanagement',
        meta: { title: '分类管理' },
        component: () => import('@/views/classmanagement.vue')
      },
      {
        path: '/custodian',
        name: 'custodian',
        meta: { title: '管理员管理' },
        component: () => import('@/views/custodian.vue')
      },
      {
        path: '/feature',
        name: 'feature',
        meta: { title: '企业特色管理' },
        component: () => import('@/views/feature.vue')
      },
      {
        path: '/management',
        name: 'management',
        meta: { title: '产品管理' },
        component: () => import('@/views/management.vue')
      },
      {
        path: '/about',
        name: 'about',
        meta: { title: '关于我们' },
        component: () => import('@/views/AboutView.vue')
      },
      {
        path: '/feature/addand',
        meta: { title: '添加焦点图' },
        component: () => import('@/components/banner/Addand.vue')
      },
      {
        path: '/feature/update/:id',
        meta: { title: '编辑焦点图' },
        component: () => import('@/components/banner/Addand.vue')
      },
      {
        path: '/centralPoint/addand',
        meta: { title: '添加焦点图' },
        component: () => import('@/components/banner/Addand.vue')
      },
      {
        path: '/centralPoint/update/:id',
        meta: { title: '编辑焦点图' },
        component: () => import('@/components/banner/Addand.vue')
      }
    ]
  },
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
